<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>系统管理</title>
  {include file="common/_require"}
  <script src="/static/lib/wangEditor/wangEditor.min.js"></script>
  <script>
    var currentHeaderNavItem = 'System';
    var currentLeftNavItem = 'agreement';
  </script>
  <style>
    .layui-form-pane .layui-form-label {
      width: 160px
    }

    .layui-form-pane .layui-input-block {
      margin-left: 160px;
    }
  </style>
</head>

<body class="layui-layout-body">

  <div class="layui-layout layui-layout-admin">
    {include file="common/_header"}

    {include file="common/left_system"}

    <div class="layui-body">

      <div style="padding:15px">
        <div class="main-header">
          <span class="layui-breadcrumb">
            <a>首页</a>
            <a><cite>用户协议管理</cite></a>
          </span>
        </div>
        <div class="main-container">
          <div class="layui-row">

            <div class="layui-col-md12">


              <div id="editor">

              </div>
              <div id="content" style="display: none;">
                {:get_system_config('user_agreement_html')}
              </div>
              <div>
                <div class="layui-btn layui-btn-fluid save-article">保存</div>
              </div>
            </div>
          </div>

        </div>
      </div>
    </div>


    {include file="common/_footer"}
  </div>
  

  <script>
    layui.use(['layer', 'upload'], function () {
      var upload = layui.upload;
      var layer = layui.layer;
      var editor = initWangEditor({
        editorElem:'#editor'
      })
      editor.txt.html($('#content').html()) // 重新设置编辑器内容

      $('.save-article').click(function () {
        var content = editor.txt.html()
        $.post("{:url('admin/System/update')}", {
          user_agreement_html: content
        }, function () {
          layer.msg('保存完成')
        })
      })
    })
  </script>
</body>

</html>